// ====================HandCardSprite====================

class Sprite_HandCard extends Sprite_Card {
    initialize(opts) {
        super.initialize(opts);
        this._abandoned = false;
    }

    show() {
        super.show();
        this._abandoned = false;
    }

    selected() {
        const x = this._ox;
        const y = this._oy - 100;
        this.setMoveAnimation(x, y);
        this.setFocus();
    }

    restore() {
        this.zIndex = this._oz;
        this.rotation = this._or;
        if(!this.isAbandoned()) {
            const x = this._ox;
            const y = this._oy;
            this.setMoveAnimation(x, y);
        }
        this.setPopular();
        this.opacity = 255;
    }

    recycle() {
        this.parent.recycleCardSprite(this);
    }

    abandon() {
        const point = this.parent.toLocal(CardGameManager.cemeteryPosition);
        this._abandoned = true;
        this.setMoveAnimation(point.x, point.y,30);
        this.setScaleAnimation(0.5, 0.5, 30);
        this.hide(45);
    }

    isAbandoned(){
        return this._abandoned;
    }
}